/// This Code Builds Monthly Data from master .txt files; 

///------------Create Panel Data Set from Monthly Allocation Data-------------/// 
insheet using "$datapath/Country Allocation/Fund Detail.txt"

// Date Set
split reportdate, parse(12:00:00 AM)
split assetclass, parse(-CA-)
drop reportdate2

* nice date format 
qui gen date = date(reportdate1,"MDY")
gen datem = mofd(date)
format datem %tm

sort fundid datem
order fundid datem
xtset fundid datem

// Generate Regions and Asset Types
drop assetclass reportdate1 reportdate 

qui rename assetclass2 assetclass
qui rename assetclass1 a_region

save "$datapath/__EPFRdata_mallocations_p.dta", replace
* end
********************************************************************************